﻿using Coldairarrow.Business.Base;
using Coldairarrow.Entity.Base;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.Base
{
    [Route("/Base/[controller]/[action]")]
    public class Base_RepairOrderFileController : BaseApiController
    {
        #region DI

        public Base_RepairOrderFileController(IBase_RepairOrderFileBusiness base_RepairOrderFileBus)
        {
            _base_RepairOrderFileBus = base_RepairOrderFileBus;
        }

        IBase_RepairOrderFileBusiness _base_RepairOrderFileBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<Base_RepairOrderFile>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _base_RepairOrderFileBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<Base_RepairOrderFileDTO> GetTheData(IdInputDTO input)
        {
            return await _base_RepairOrderFileBus.GetTheDataAsync(input.id);
        }

        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(Base_RepairOrderFile data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _base_RepairOrderFileBus.AddDataAsync(data);
            }
            else
            {
                await _base_RepairOrderFileBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        public async Task DeleteData(List<string> ids)
        {
            await _base_RepairOrderFileBus.DeleteDataAsync(ids);
        }

        /// <summary>
        /// Pc获取设备文档列表 设备list
        /// </summary>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageResult<Base_RepairOrderFileDTO>> GetDataListInfo(PageInput<PB_ScheduleDetailConditionDTO> input) { 
        return await _base_RepairOrderFileBus.GetDataListInfo(input);
        }
/// <summary>
/// pc 获取设备的文档明细
/// </summary>
/// <param name="input"></param>
/// <param name="DeviceId"></param>
/// <returns></returns>
       [HttpPost]
        public async Task<PageResult<Base_RepairOrderFileListDTO>> GetDataListDeviceId(PageInput<PB_ScheduleDetailConditionDTO> input, string DeviceId) {
            var listData =await _base_RepairOrderFileBus.GetDataListDeviceId(input,DeviceId);
            return listData;
        }
        #endregion
    }
}